//
//  LogoSetTableViewCell.m
//  TeamInformatization
//
//  Created by bigger on 2019/4/1.
//  Copyright © 2019年 SPIC. All rights reserved.
//

#import "LogoSetTableViewCell.h"

@interface LogoSetTableViewCell ()

@property (nonatomic, strong) SimpleLabel *setTitle;

// 头像
@property (nonatomic, strong) UIImageView *logoImageView;

@end

@implementation LogoSetTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatCellView];
        
        self.backgroundColor = [UIColor whiteColor];
        // 取消cell选中状态
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)creatCellView
{
    self.setTitle = [SimpleLabel initWithText:@"" TextColor:kTitleTextColor TextFont:[UIFont systemFontOfSize:15] TextAlignment:NSTextAlignmentLeft];
    [self addSubview:_setTitle];
    [_setTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(15 * kScaleWidth);
        make.centerY.mas_equalTo(self);
    }];
    
    UIImageView *arrowIamge = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"箭头"]];
    [self addSubview:arrowIamge];
    [arrowIamge mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.right.mas_equalTo(-10 * kScaleWidth);
    }];
    
    SimpleLabel *setContent = [SimpleLabel initWithText:@"上传头像" TextColor:kSubTitleTextColor TextFont:[UIFont systemFontOfSize:13] TextAlignment:NSTextAlignmentRight];
    [self addSubview:setContent];
    [setContent mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(arrowIamge.mas_left).offset(-5 * kScaleWidth);
        make.centerY.mas_equalTo(self);
    }];
    
    
    self.logoImageView = [[UIImageView alloc] init];
    [self addSubview:_logoImageView];
    [_logoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self);
        make.right.mas_equalTo(setContent.mas_left).offset(-5 * kScaleWidth);
    }];
    _logoImageView.layer.masksToBounds = YES;
    _logoImageView.layer.cornerRadius = 15. * kScaleWidth;
    _logoImageView.layer.shouldRasterize = YES; //圆角缓存
    _logoImageView.layer.rasterizationScale = [UIScreen mainScreen].scale;// 抗锯齿边缘
    
}

- (void)setCellTitle:(NSString *)title LogoImageStr:(NSString *)imageStr
{
    _setTitle.text = title;
    [_logoImageView sd_setImageWithURL:[NSURL URLWithString:imageStr]];
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
